import React, { FC,useEffect } from 'react'
import { 
    useNavigate,
    // Link
} from 'react-router-dom'
import { Button,Typography } from 'antd';
import {MANAGE_INDEX_PATHNAME} from '../router/index.tsx'
import  './Home.css'
// import '../_mock/index.ts'
import axios from 'axios'
const { Title,Paragraph }  = Typography
const Home: FC = ()=>{
    const nav = useNavigate()
    // const clickHandler = ()=>{
    //     // nav('/login?20')
    //     nav({pathname:'/login',search: 'b=22'})
    // }

    useEffect(()=>{
        // 1、劫持不到
        fetch('/api/test')
            .then(res => res.json())
            .then(data => console.log('fetchData',data)
        )

        // 2、 
        axios.get('/api/test').then((res:any) =>{
            console.log('res.data',res.data)
        })
    },[])
    return(
        <div className="home">
            <div className="info">
                <Title>问卷调查 | 在线投票</Title>
                <Paragraph>已累计创建问卷 100份,发布问卷 90份,收到答卷 980份</Paragraph>
                <div>
                    <Button type="primary" onClick={()=> nav(MANAGE_INDEX_PATHNAME)}>开始使用</Button>
                </div>
            </div>
        </div>
    )
}


export default Home